<?php

namespace App\Validate;

class RbcValidation extends BaseValidation
{
    // 调用案例 check支持自定义规则

    // make(AmountValidation::class)->check($this->request->all(),__FUNCTION__)

    //返回响应值的  ->response()

    //返回boole   ->get()

    //返回报错信息  ->getError()

    //验证规则
    protected $rule =[
        'identity'=>'required',
        'name'=>'required',
        'sort_order'=>'required',
        'parent_id'=>'required',
        'url'=>'required',
        'role_id'=>'required',
        'permission_id'=>'required',
        'id'=>'required',
    ];
    //自定义验证信息
    protected $message = [
        'name.required'=>'名字 必须',
        'identity.required'=>'权限标识 必须',
        'url.required'=>'权限地址 必须',
        'role_id.required'=>'角色id 必须',
        'permission_id.required'=>'权限id 必须',
        'id.required'=>'id 必须',
        'parent_id.required'=>'parent_id 必须',
    ];
    
    //自定义场景
    protected $scene = [
        'add'=>"name,identity",
        'edit_get'=>"id",
        'edit_post'=>"name,identity,id,sort_order,parent_id",
        'role_add'=>"name",
        'role_post'=>"name,id",
        'role_per_get'=>"role_id",
        'role_per_post'=>"role_id,permission_id",
    ];
}
